<div class="tradePanel">
	<div id=trade></div>
	<g:formRemote name="trade" controler="turn" action="tradeShare"
		update="actionPanel" url="${[action:'tradeShare']}">

		<table class="table table-bordered table-condensed">
			<tr>
				<th>share</th>
				<th>price</th>
				<th>difference</th>
				<th># old</th>
				<th># new</th>
			<tr>
			<g:each in="${shareList}" status="i" var="share">
				<tr class="shareRow" data-id="${i}">
					<g:hiddenField name="shareId.${i}" value="${share.id}"/>
					<td><label for="quatity">${share.name}</label></td>
					<td id="sharePrice-${i}" style="text-align:right;">${share.price}</td>
					<td>
						<g:textField id="diff-${i}" name="quantity.${i}" value="0" size="3" style="width:2em; margin:1px;" onkeyup="incrementValue(0,${i})"></g:textField>
					    <div class="btn-group btn-group-vertical">
							<a class="btn btn-mini plus" href="#" onclick="incrementValue(1,${i});"><i class="icon-plus-sign"></i></a>
							<a class="btn btn-mini minus" href="#" onclick="incrementValue(-1,${i});"><i class="icon-minus-sign"></i></a>
   						</div>
					</td>
					<td id="countOld-${i}" style="text-align:right;">${shareCount[share.id]?:0 }</td>
					<td id="countNew-${i}" style="text-align:right;">${shareCount[share.id]?:0 }</td>
				</tr>
			</g:each>
		</table>
		<table class="table table-bordered table-condensed">
			<tr><th>cash old</th> <th>cash new</th></tr>
			<tr><td id="cashOld">${player?.cash}</td><td id="cashNew">${player?.cash}</td></tr>
		</table>
		<g:actionSubmit style="display:none" value="donothing" action="none" onclick="return false;"></g:actionSubmit>
		<g:actionSubmit id="tradeBtn" class="btn btn-large btn-primary" value="End Turn" action="tradeShare"></g:actionSubmit>
	</g:formRemote>
</div>

